305

We want to know how many activated molecules STAT are present at time t = 3. To do

this, we can calculate the solution in R and draw the graph of STAT concentration (in this

example, n0 = 10, alpha = 5 and beta = 10%).

> n0 <-10 # number of Epo molecules at time t0.

> a <-5 # alpha

> b <-0.1 # beta

> stat <- 0

> stat[1] <-a*n0*(1-b) # Actually time t0, but R doesn't

like 0 as index.

> for (t in 2:20) {stat[t] <-(stat[t-1]+a*n0*exp(-

t+1))*(1-b)} # A loop that always increments t by 1 and

performs the calculation.

Looking at stat now, we always have to subtract 1 from the index to get the correct

value. After all, we had already stored t0 as t1.

> stat

[1] 45.00000 57.05457 57.43921 53.93570 49.36634 44.73291

40.37116 36.37508

19.6  Introduction to Programming (Meta Tutorial)